import {Injectable, Input} from '@angular/core';
import {EmergencyFind} from "../dto/EmergencyFind";
import {HttpClient, HttpHeaders} from "@angular/common/http";

@Injectable({
  providedIn: 'root'
})
export class EmergencyFindService {
  @Input() emergencyFind?: EmergencyFind;
  constructor(private httpClient: HttpClient) { }

    getLawyer(emergencyFind: EmergencyFind | undefined) {
    console.log('emergencyFindService')
    console.log(emergencyFind)
    let jsonObj = JSON.stringify(emergencyFind)
    const headers = new HttpHeaders().set('Content-Type', 'application/json; charset=utf-8')
    return this.httpClient.post("http://localhost:8189/api/v1/emergency", jsonObj,
      {
        headers
      })
      .subscribe(data => {
        console.log(data)
    })
  }
}
